package com.fresh.liangyi.dao;

import com.fresh.liangyi.model.domain.Goods;
import com.fresh.liangyi.model.domain.Menu;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
@Component
public interface MenuMapper {
    @Select("SELECT * FROM menu")
    public List<Menu> selectMenuAll();

    @Select("SELECT * FROM menu where id=#{id}")
    public Menu selectMenuById(Integer id);

    //添加商品
    @Options(useGeneratedKeys = true,keyProperty="id")//返回主键到实体类中
    @Insert("INSERT INTO menu(title,content,create_date,image,tag) " +
            "VALUES(#{title},#{content},#{createDate},#{image},#{tag})")
    public int addMenu(Menu menu);
}
